<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use common\models\farmerhouse\FarmerhouseHouse;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\farmerhouse\models\FarmerhouseHouseSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '农家乐财务';
$this->params['breadcrumbs'][] = $this->title;
?>


<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
              <?= Html::a('返回','javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>
        <div class="panel-body">
            <div class="adv-table editable-table ">

                <div class="farmerhouse-house-index">

                    <?= GridView::widget([
                        'dataProvider'=>$dataProvider,
                        'filterModel'=>$searchModel,
                        'showPageSummary'=>true,
                        'pjax'=>true,
                        'striped'=>true,
                        'hover'=>true,
                        'panel'=>['type'=>'primary', 'heading'=>'农家乐'],
                        'containerOptions'=>['style'=>'overflow: auto'], // only set when $responsive = false
                        'headerRowOptions'=>['class'=>'kartik-sheet-style'],
                        'filterRowOptions'=>['class'=>'kartik-sheet-style'],
                        'columns'=>[
                            [
                                'class'=>'kartik\grid\ExpandRowColumn',
                                'width'=>'50px',
                                'value'=>function ($model, $key, $index, $column) {
                                    return GridView::ROW_COLLAPSED;
                                },
                                'detail'=>function ($model, $key, $index, $column) {
                                    return Yii::$app->controller->renderPartial('detail', ['model'=>$model]);
                                },
                                'headerOptions'=>['class'=>'kartik-sheet-style'],
                                'expandOneOnly'=>true
                            ],
                            [
                                'label' => '业务员',
                                'attribute'=>'person.name',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'label' => '农户',
                                'attribute'=>'farmer.name',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'attribute'=>'roomnum',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'attribute'=>'caninnum',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'attribute'=>'price',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'attribute'=>'address',
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],


                            [
                                'attribute'=>'isrecommand',
                                'value' => function($model){
                                    return FarmerhouseHouse::$isrecommand[$model->isrecommand];
                                },
                                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                                'width'=>'100px',
                            ],
                            [
                                'class' => '\kartik\grid\ActionColumn',
                                'deleteOptions' => ['label' => '<i class="glyphicon glyphicon-remove"></i>'],
                                'options' => ['width' => '100px;'],
                                'template' => '{view}',
                                'buttons' => [
                                    'view' => function ($url, $model) {
                                        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>',Url::to(['/farmerhouse/house/view','id'=>$model->id]),[
                                            'title' => '详情'
                                        ]);
                                    }
                                ],
                            ],
                        ],
                        'toolbar'=> [
                            '{export}',
                            '{toggleData}',
                        ],
                        'bordered'=>true,
                        'condensed'=>true,
                    ]);
                    ?>




                </div>
            </div>
        </div>
    </section>
</section>





